import { HashRouter } from 'react-router-dom';
import EventEmitter from 'events';
import LocalStorage from 'localstorage';

export const router = new HashRouter()

export const bus = new EventEmitter()

export const commonLS = new LocalStorage('common_')

export const toLoginWithFrom = (ins) => {
  const { history } = (ins || router)
  const { pathname } = history.location
  console.log(ins)
  history.push({ pathname: '/login', search: `?from=${pathname}` })
}
